<?php
require_once 'config.inc.php';

//print_r($_SERVER);


//1.清空session数组
	$_SESSION = array();
	
//2.删除cookeie中的session_id  加个条件防止报错.
	if(isset($_COOKIE[session_name()])){
		setCookie(session_name(),'',time()-3600,'/');
	}

//3.销毁所有session资源
	session_destroy();
	//echo '完成上面三步,做到了彻底注销!';
	//[HTTP_HOST] => localhost
	//[REQUEST_URI] => /kp5b_blog/unlogin.php
    //[SCRIPT_NAME] => /kp5b_blog/unlogin.php
    //[PHP_SELF] => /kp5b_blog/unlogin.php
	
	if(!empty($_SERVER['HTTP_REFERER'])){
		//header('location:'.$_SERVER['HTTP_REFERER']);
	}
	print_r($_SERVER);
	print_r(apache_request_headers());
	//echo '<script type="text/javascript">alert("注销成功!");location = document.referrer;</script>';
	//echo '<script type="text/javascript">alert("注销成功!");if(document.URL != document.referrer){location = document.referrer;}</script>';
?>

<script type="text/javascript">
	alert("注销成功!");
	if(document.URL != document.referrer && document.referrer != ''){
		location = document.referrer;
	}
</script>